const Login = resolve => require.ensure([], () => resolve(require('@/views/login.vue')), 'Login')
const Main = resolve => require.ensure([], () => resolve(require('@/views/main.vue')), 'Main')
const Home = resolve => require.ensure([], () => resolve(require('@/views/home/home.vue')), 'Home')
    /**流程管理 */
const Repaire = resolve => require.ensure([], () => resolve(require('@/views/procedure/repaire.vue')), 'Repaire')
const Check = resolve => require.ensure([], () => resolve(require('@/views/procedure/check.vue')), 'Check')
const OfficeSupplies = resolve => require.ensure([], () => resolve(require('@/views/procedure/officeSupplies.vue')), 'OfficeSupplies')
const ReceiptOfVoucher = resolve => require.ensure([], () => resolve(require('@/views/procedure/receiptOfVoucher.vue')), 'ReceiptOfVoucher')
const ServiceActionLog = resolve => require.ensure([], () => resolve(require('@/views/procedure/serviceActionLog.vue')), 'ServiceActionLog')
const Response = resolve => require.ensure([], () => resolve(require('@/views/procedure/response.vue')), 'Response')

/**内容管理 */
const Banner = resolve => require.ensure([], () => resolve(require('@/views/cms/banner.vue')), 'Banner')
const KnowledgeBase = resolve => require.ensure([], () => resolve(require('@/views/cms/knowledgeBase.vue')), 'KnowledgeBase')
const Message = resolve => require.ensure([], () => resolve(require('@/views/cms/message.vue')), 'Message')
const Feedback = resolve => require.ensure([], () => resolve(require('@/views/cms/feedback.vue')), 'Feedback')
const InspTemp = resolve => require.ensure([], () => resolve(require('@/views/cms/inspTemp.vue')), 'InspTemp')

/**组织机构 */
const OrgMange = resolve => require.ensure([], () => resolve(require('@/views/organization/orgMange.vue')), 'OrgMange')
const RepairStaff = resolve => require.ensure([], () => resolve(require('@/views/organization/repairStaff.vue')), 'RepairStaff')
const Exver = resolve => require.ensure([], () => resolve(require('@/views/organization/exver.vue')), 'Exver')
const Service = resolve => require.ensure([], () => resolve(require('@/views/organization/service.vue')), 'Service')
const Reope = resolve => require.ensure([], () => resolve(require('@/views/organization/reope.vue')), 'Reope')
const OperationStaff = resolve => require.ensure([], () => resolve(require('@/views/organization/operationStaff.vue')), 'OperationStaff')
const EmerGroup = resolve => require.ensure([], () => resolve(require('@/views/organization/emerGroup.vue')), 'EmerGroup')

/**设备管理 */
const EqumList = resolve => require.ensure([], () => resolve(require('@/views/device/equmList.vue')), 'EqumList')
const BatchAddition = resolve => require.ensure([], () => resolve(require('@/views/device/batchAddition.vue')), 'BatchAddition')
const Devicetype = resolve => require.ensure([], () => resolve(require('@/views/device/devicetype.vue')), 'Devicetype')

/**数据统计 */
const MaSta = resolve => require.ensure([], () => resolve(require('@/views/data/maSta.vue')), 'MaSta')
const OfSta = resolve => require.ensure([], () => resolve(require('@/views/data/ofSta.vue')), 'OfSta')
const CeSta = resolve => require.ensure([], () => resolve(require('@/views/data/ceSta.vue')), 'CeSta')

/**合作伙伴 */
const Cusmg = resolve => require.ensure([], () => resolve(require('@/views/partner/cusmg/cusmg.vue')), 'Cusmg')
const Serpro = resolve => require.ensure([], () => resolve(require('@/views/partner/serpro.vue')), 'Serpro')
const Supplier = resolve => require.ensure([], () => resolve(require('@/views/partner/supplier.vue')), 'Supplier')
const Config = resolve => require.ensure([], () => resolve(require('@/views/partner/cusmg/config.vue')), 'Config')

/**采购管理 */
const OfList = resolve => require.ensure([], () => resolve(require('@/views/purchase/ofList.vue')), 'OfList')
const OfType = resolve => require.ensure([], () => resolve(require('@/views/purchase/ofType.vue')), 'OfType')
const PzList = resolve => require.ensure([], () => resolve(require('@/views/purchase/pzList.vue')), 'PzList')
const PzType = resolve => require.ensure([], () => resolve(require('@/views/purchase/pzType.vue')), 'PzType')

/**系统管理 */
const Operator = resolve => require.ensure([], () => resolve(require('@/views/system/operator.vue')), 'Operator')
const GroupMg = resolve => require.ensure([], () => resolve(require('@/views/system/groupMg.vue')), 'GroupMg')
const RoleMg = resolve => require.ensure([], () => resolve(require('@/views/system/roleMg.vue')), 'RoleMg')
const ProcessConfig = resolve => require.ensure([], () => resolve(require('@/views/system/processConfig.vue')), 'ProcessConfig')
const AppModules = resolve => require.ensure([], () => resolve(require('@/views/system/appModules.vue')), 'AppModules')
const AppVersion = resolve => require.ensure([], () => resolve(require('@/views/system/appVersion.vue')), 'AppVersion')
const Subadministrator = resolve => require.ensure([], () => resolve(require('@/views/system/subadministrator.vue')), 'Subadministrator')
const ServiceMg = resolve => require.ensure([], () => resolve(require('@/views/system/serviceMg.vue')), 'ServiceMg')
const RepaireConfig = resolve => require.ensure([], () => resolve(require('@/views/system/repaireConfig.vue')), 'RepaireConfig')
const InspectionConfig = resolve => require.ensure([], () => resolve(require('@/views/system/inspectionConfig.vue')), 'InspectionConfig')
const OffSupConfig = resolve => require.ensure([], () => resolve(require('@/views/system/offSupConfig.vue')), 'OffSupConfig')
const VoucherConfig = resolve => require.ensure([], () => resolve(require('@/views/system/voucherConfig.vue')), 'VoucherConfig')


export const loginRouter = {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
        title: '点点维-登录'
    }
}
export const otherRouter = {
    path: '/index',
    name: 'otherRouter',
    component: Main,
    children: [{
        path: 'home',
        title: '状态总览',
        name: 'home_index',
        component: Home
    }]
}
export const page403 = {
    path: '/*',
    name: 'error-403',
    meta: {
        title: '403-权限不足'
    },
    component: () =>
        import ('@/views/error-page/403.vue')
};
export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () =>
        import ('@/views/error-page/404.vue')
};

export const appRouter = [{
        path: '/',
        redirect: '/login'
    },
    {
        path: '/procedure',
        icon: 'network',
        name: 'procedure',
        title: '流程管理',
        component: Main,
        children: [{
            path: 'repaire',
            title: '设备维修',
            icon: '',
            name: 'repaire',
            component: Repaire
        }, {
            path: 'check',
            title: '场地巡检',
            icon: '',
            name: 'check',
            component: Check
        }, {
            path: 'officeSupplies',
            title: '办公用品',
            icon: '',
            name: 'officeSupplies',
            component: OfficeSupplies
        }, {
            path: 'receiptOfVoucher',
            title: '凭证请领',
            icon: '',
            name: 'receiptOfVoucher',
            component: ReceiptOfVoucher
        }, {
            path: 'serviceActionLog',
            title: '维修记录',
            icon: '',
            name: 'serviceActionLog',
            component: ServiceActionLog
        }, {
            path: 'response',
            title: '应急响应',
            icon: '',
            name: 'response',
            component: Response
        }]
    },
    {
        path: '/cms',
        icon: 'ios-book-outline',
        name: 'cms',
        title: '内容管理',
        component: Main,
        children: [{
            path: 'banner',
            title: 'BANNER',
            icon: '',
            name: 'banner',
            component: Banner
        }, {
            path: 'knowledgeBase',
            title: '知识库',
            icon: '',
            name: 'knowledgeBase',
            component: KnowledgeBase
        }, {
            path: 'message',
            title: '消息管理',
            icon: '',
            name: 'message',
            component: Message
        }, {
            path: 'feedback',
            title: '用户反馈',
            icon: '',
            name: 'feedback',
            component: Feedback
        }, {
            path: 'inspTemp',
            title: '巡检模板',
            icon: '',
            name: 'inspTemp',
            component: InspTemp
        }]
    },
    {
        path: '/organization',
        icon: 'ios-color-filter-outline',
        name: 'organization',
        title: '组织机构',
        component: Main,
        children: [{
            path: 'orgMange',
            title: '机构管理',
            icon: '',
            name: 'orgMange',
            component: OrgMange
        }, {
            path: 'repairStaff',
            title: '报修人',
            icon: '',
            name: 'repairStaff',
            component: RepairStaff
        }, {
            path: 'exver',
            title: '待审核报修人',
            icon: '',
            name: 'exver',
            component: Exver
        }, {
            path: 'service',
            title: '服务商架构',
            icon: '',
            name: 'service',
            component: Service
        }, {
            path: 'operationStaff',
            title: '运维人员',
            icon: '',
            name: 'operationStaff',
            component: OperationStaff
        }, {
            path: 'reope',
            title: '待审核运维',
            icon: '',
            name: 'reope',
            component: Reope
        }, {
            path: 'emerGroup',
            title: '应急分组',
            icon: '',
            name: 'emerGroup',
            component: EmerGroup
        }]
    },
    {
        path: '/device',
        icon: 'laptop',
        name: 'device',
        title: '设备管理',
        component: Main,
        children: [{
            path: 'equmList',
            title: '设备列表',
            icon: '',
            name: 'equmList',
            component: EqumList
        }, {
            path: 'batchAddition',
            title: '批量新增',
            icon: '',
            name: 'batchAddition',
            component: BatchAddition
        }, {
            path: 'devicetype',
            title: '设备类型',
            icon: '',
            name: 'devicetype',
            component: Devicetype
        }]
    },
    {
        path: '/dataSta',
        icon: 'ios-analytics-outlin',
        name: 'dataSta',
        title: '数据统计',
        component: Main,
        children: [{
            path: 'maSta',
            title: '维修统计',
            iocn: '',
            name: 'maSta',
            component: MaSta
        }, {
            path: 'ofSta',
            title: '办公用品',
            iocn: '',
            name: 'ofSta',
            component: OfSta
        }, {
            path: 'ceSta',
            title: '凭证请领',
            iocn: '',
            name: 'ceSta',
            component: CeSta
        }]
    },
    {
        path: '/partner',
        icon: 'ios-people-outline',
        name: 'partner',
        title: '合作伙伴',
        component: Main,
        children: [{
                path: 'cusmg',
                icon: '',
                name: 'cusmg',
                title: '客户管理',
                component: Cusmg,
            },
            {
                path: 'config',
                icon: '',
                name: 'config',
                title: '客户管理',
                component: Config,
            },
            {
                path: 'serpro',
                icon: '',
                name: 'serpro',
                title: '服务商',
                component: Serpro,
            },
            {
                path: 'supplier',
                icon: '',
                name: 'supplier',
                title: '供应商',
                component: Supplier,
            },
        ]
    },
    {
        path: '/purchase',
        icon: 'bag',
        name: 'purchase',
        title: '采购管理',
        component: Main,
        children: [{
                path: 'ofList',
                icon: '',
                name: 'ofList',
                title: '办公用品列表',
                component: OfList,
            },
            {
                path: 'ofType',
                icon: '',
                name: 'ofType',
                title: '办公用品类型',
                component: OfType,
            },
            {
                path: 'pzList',
                icon: '',
                name: 'pzList',
                title: '凭证列表',
                component: PzList,
            },
            {
                path: 'pzType',
                icon: '',
                name: 'pzType',
                title: '凭证类型',
                component: PzType,
            },
        ]
    },
    {
        path: '/system',
        icon: 'ios-cog-outline',
        name: 'system',
        title: '系统管理',
        component: Main,
        children: [{
                path: 'operator',
                icon: '',
                name: 'operator',
                title: '操作员',
                component: Operator,
            },
            {
                path: 'groupMg',
                icon: '',
                name: 'groupMg',
                title: '分组管理',
                component: GroupMg,
            },
            {
                path: 'roleMg',
                icon: '',
                name: 'roleMg',
                title: '角色管理',
                component: RoleMg,
            },
            {
                path: 'processConfig',
                icon: '',
                name: 'processConfig',
                title: '流程配置',
                component: ProcessConfig,
            },
            {
                path: 'appModules',
                icon: '',
                name: 'appModules',
                title: 'APP模块',
                component: AppModules,
            },
            {
                path: 'appVersion',
                icon: '',
                name: 'appVersion',
                title: 'APP版本',
                component: AppVersion,
            },
            {
                path: 'subadministrator',
                icon: '',
                name: 'subadministrator',
                title: '子管理员',
                component: Subadministrator,
            },
            {
                path: 'serviceMg',
                icon: '',
                name: 'serviceMg',
                title: '服务商管理',
                component: ServiceMg,
            },
            {
                path: 'repaireConfig',
                icon: '',
                name: 'repaireConfig',
                title: '维修配置',
                component: RepaireConfig,
            },
            {
                path: 'inspectionConfig',
                icon: '',
                name: 'inspectionConfig',
                title: '巡检配置',
                component: InspectionConfig,
            },
            {
                path: 'offSupConfig',
                icon: '',
                name: 'offSupConfig',
                title: '办公用品配置',
                component: OffSupConfig,
            },
            {
                path: 'voucherConfig',
                icon: '',
                name: 'voucherConfig',
                title: '凭证请领配置',
                component: VoucherConfig,
            }
        ]
    }

]

export const routers = [
    loginRouter,
    otherRouter,
    ...appRouter,
    page404,
    page403,
]